<?php $user = $this->user?>
<?php $myCartObj = new Cart(); $myCartInfo = $myCartObj->getMyCart();$siteConfig=new Config("site_config");?>
<?php $siteConfigObj = new Config("site_config");$site_config   = $siteConfigObj->getInfo();?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $siteConfig->name;?></title>
<link type="image/x-icon" href="favicon.ico" rel="icon">
<link type="image/x-icon" href="favicon.ico" rel="bookmark">
<link rel="stylesheet" href="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/css/index.css";?>" />
<link rel="stylesheet" href="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/css/jquery.jqzoom.css";?>" />
<script charset="UTF-8" src="/runtime/systemjs/jquery-1.4.4.min.js"></script>
<script charset="UTF-8" src="/runtime/systemjs/form.js"></script>
<link rel="stylesheet" type="text/css" href="/runtime/systemjs/autovalidate/style.css"/><script charset="UTF-8" src="/runtime/systemjs/autovalidate/validate.js"></script>
<script charset="UTF-8" src="/runtime/systemjs/artdialog/artDialog.min.js"></script>
<script type='text/javascript' src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/common.js";?>"></script>
<script type='text/javascript' src="<?php echo IUrl::creatUrl("/javascript/adloader/");?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/";?>jquery.bxSlider/bx_styles/bx_styles.css" />
</head>
<body class="index">
<div class="container">
	<div class="header">
		<h1 class="logo"><a title="<?php echo $siteConfig->name;?>" style="background:url(<?php echo IUrl::creatUrl("")."image/logo.gif";?>);" href="<?php echo IUrl::creatUrl("");?>"><?php echo $siteConfig->name;?></a></h1>
		<ul class="shortcut">
			<li class="first"><a href="<?php echo IUrl::creatUrl("/ucenter/index");?>">我的账户</a></li><li><a href="<?php echo IUrl::creatUrl("/ucenter/order");?>">我的订单</a></li><!-- <li class='last'><a href="<?php echo IUrl::creatUrl("/site/help_list");?>">使用帮助</a></li> -->
		</ul>
		<p class="loginfo">
			<?php if((isset($user['user_id']) && $user['user_id']!='')){?><?php echo isset($user['username'])?$user['username']:"";?>您好，欢迎您来到<?php echo $siteConfig->name;?>购物！[<a href="<?php echo IUrl::creatUrl("/simple/logout");?>" class="reg">安全退出</a>]<?php }else{?>[<a href="<?php echo IUrl::creatUrl("/simple/login");?>">登录</a>
			<?php $callback = IReq::get('callback')?>
			<?php if($callback==""){?>
			<a class="reg" href="<?php echo IUrl::creatUrl("/simple/reg");?>">免费注册</a>
			<?php }else{?>
			<?php $callback=urlencode($callback);?>
			<a class="reg" href="<?php echo IUrl::creatUrl("/simple/reg/?callback=$callback");?>">免费注册</a>
			<?php }?>
			]
			<?php }?>
		</p>
	</div>
	<div class="navbar">
		<ul>
			<li><a href="<?php echo IUrl::creatUrl("");?>">首页</a></li>
			<?php $i=0;?>
			<?php $query = new IQuery("guide");$items = $query->find(); foreach($items as $key => $item){?>
			<?php $i++;$item['link']=IUrl::creatUrl($item['link']);?>
			<li <?php if($i==count($items)){?>style="background:none;"<?php }?>><a href="<?php echo isset($item['link'])?$item['link']:"";?>"><?php echo isset($item['name'])?$item['name']:"";?><span> </span></a></li>
			<?php }?>
		</ul>

		<div class="mycart">
			<dl>
				<dt><a href="<?php echo IUrl::creatUrl("/simple/cart");?>">购物车<b name="mycart_count"><?php echo isset($myCartInfo['count'])?$myCartInfo['count']:"";?></b>件</a></dt>
				<dd><a href="<?php echo IUrl::creatUrl("/simple/cart");?>">去结算</a></dd>
			</dl>

			<!--购物车浮动div 开始-->
			<div class="shopping" id='div_mycart' style='display:none;'>
			</div>
			<!--购物车浮动div 结束-->

		</div>
	</div>

	<div class="searchbar">
		<div class="allsort">
			<a href="javascript:void(0);">全部商品分类</a>

			<!--总的商品分类-开始-->
			<ul class="sortlist" id='div_allsort' style='display:none'>
				<?php $this->goodsCategory = block::goods_category();?>
				<?php foreach($this->goodsCategory as $key => $first){?>
					<li>
						<h2><a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/$first[id]");?>"><?php echo isset($first['name'])?$first['name']:"";?></a></h2>

						<!--商品分类 浮动div 开始-->
						<div class="sublist" style='display:none'>

							<div class="items">
								<strong>选择分类</strong>
								<?php if(isset($first['second'])){?>
								<?php foreach($first['second'] as $key => $second){?>
								<dl class="category selected">
									<dt>
										<a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/$second[id]");?>"><?php echo isset($second['name'])?$second['name']:"";?></a>
									</dt>

									<dd>
										<?php if(isset($second['more'])){?>
										<?php foreach($second['more'] as $key => $third){?>
										<a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/$third[id]");?>"><?php echo isset($third['name'])?$third['name']:"";?></a>|
										<?php }?>
										<?php }?>
									</dd>
								</dl>
								<?php }?>
								<?php }?>

							</div>

						</div>
						<!--商品分类 浮动div 结束-->

					</li>
				<?php }?>

			</ul>
			<!--总的商品分类-结束-->

		</div>

		<div class="searchbox">
			<form method='get'>
				<input type='hidden' name='controller' value='site' />
				<input type='hidden' name='action' value='search_list' />
				<?php $word = IReq::get('word');?>
				<input class="text" type="text" name='word' id="word" autocomplete="off" value="<?php echo $word ? $word : '输入关键字...';?>" />
				<input class="btn" type="submit" value="商品搜索" onclick="checkInput('word','输入关键字...');" />
			</form>

			<!--自动完成div 开始-->
			<ul class="auto_list" style='display:none'></ul>
			<!--自动完成div 开始-->

		</div>
		<div class="hotwords">热门搜索：
			<?php $query = new IQuery("keyword");$query->where = "hot = 1";$query->limit = "5";$query->order = "`order` asc";$items = $query->find(); foreach($items as $key => $item){?>
			<?php $tmpWord = urlencode($item['word']);?>
			<a href="<?php echo IUrl::creatUrl("/site/search_list/word/$tmpWord");?>"><?php echo isset($item['word'])?$item['word']:"";?></a>
			<?php }?>
		</div>
	</div>
	<div class="m_10" id="adHere_1"></div>
	<script language="javascript">
	(new adLoader()).load(1,'adHere_1');
	</script>

		<?php $seo_data=array(); $site_config=new Config('site_config');$site_config=$site_config->getInfo();?>
	<?php $seo_data['title']=$name?>
	<?php if(isset($site_config['name'])){?>
		<?php $seo_data['title'].="_".$site_config['name']?>
	<?php }?>
	<?php if($keywords!=""){?>
		<?php $seo_data['keywords']=$keywords?>
	<?php }?>
	<?php if($description!=""){?>
		<?php $seo_data['description']=$description?>
	<?php }?>
	<?php seo::set($seo_data);?>

<script type="text/javascript" src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/cookie.js";?>"></script>
<script type="text/javascript" src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/jquery.jqzoom-core-pack.js";?>"></script>
<script language="javascript" type="text/javascript">
$(function() {
	//js加载cookie recentlyviewedproducts
	var cook = $.cookie('recentlyviewedproducts');
	if(cook=='' || cook == null)
	{
		cook = '<?php echo isset($id)?$id:"";?>'+',';
	}
	else
	{
		var temp = ','+cook;
		var str = ','+'<?php echo isset($id)?$id:"";?>'+',';
		if(!(temp.indexOf(str)>=0))
		{
			cook += '<?php echo isset($id)?$id:"";?>'+',';
		}
	}
	$.cookie('recentlyviewedproducts',cook);

	$('.sel_area').hover(
			function(){
				$('.area_box').show();
			},function(){
				$('.area_box').hide();
			}
	);
	$('.area_box').hover(
			function(){
				$('.area_box').show();
			},function(){
				$('.area_box').hide();
			}
	);
});
var url_path = 	encodeURIComponent('<?php echo isset($url)?$url:"";?>');
function searPrivice(value)
{
	var url = '<?php echo IUrl::creatUrl("/block/searchPrivice/@Math@");?>';
	url = url.replace("@Math@",Math.random);

	$.get(url,{area_name:value},function(date){
		if(date!="0")
		{
			var arr = date.split(',');
			delivery(arr[0],arr[1]);
		}
		else
		{
			delivery('0',value);
		}
	});
}
function delivery(privice,city)
{
	$('#city').html(city);
	var weight = '<?php echo isset($weight)?$weight:"";?>';//重量
	var number = $('#number').val();
	if(number==undefined)
	{
		number = 1;
	}
	//通过省份id查询出配送方式，并且传送总重量计算出运费,然后显示配送方式Math.random
	weight = parseInt(weight)*parseInt(number);
	var url = '<?php echo IUrl::creatUrl("/block/order_delivery/province/@privice@/weight/@weight@/@Math@");?>';
	url = url.replace("@privice@",privice).replace("@weight@",weight).replace("@Math@",Math.random);
	$.getJSON(url,	function(json){
		var html_va = '';
		for( a in json)
		{
			if(json[a]['if_delivery']==0)
			{
				html_va += json[a]['name']+':<b class="orange">'+json[a]['price']+'元</b>';
				if(json[a]['description']!='')
				{
					html_va += '('+json[a]['description']+')';
				}
				html_va += '&nbsp;&nbsp;';
			}
			else
			{
				html_va += json[a]['name']+':<b class="orange">该地区无法送到</b>&nbsp;&nbsp;';
			}
		}
		$('#delive').html(html_va);
	});
}
function clearCook()
{
	$.cookie('recentlyviewedproducts',null);
	window.location.reload();
}

//选择当前Tab
function selectTab(curr_div,curr_lab)
{
	$("div[name='div_name']").hide();
	$("#"+curr_div).show();

	$("label[name='lab-name']").removeClass();
	$("#"+curr_lab).addClass('current');
}

function check_type()
{
	//goods模式
	if($('#products_id').val() == undefined)
	{
		var type = 'goods';
	}

	//product模式
	else
	{
		var product_id = parseInt($('#products_id').val());
		if(isNaN(product_id))
		{
			msg = '请选择商品的规格';
		}
		var goods_id = product_id;
		var type     = 'product';
	}
	return type;

}

//显示抢购倒计时
var cd_timer = new countdown();

//立即购买按钮
function buy_now()
{
	var num  = $('#number').val();

	<?php if(isset($spec_ids) && count($spec_ids)>0){?>
	var type = 'product';
	var id   = $('#products_id').val();
	<?php }else{?>
	var type = 'goods';
	var id   = $('#goods_id').val();
	<?php }?>

	if(type == 'product' && id == '')
	{
		alert('请选择货品的规格值');
		return '';
	}
	<?php $promo = IReq::get('promo') ? '&promo='.IReq::get('promo').'&active_id='.IReq::get('regiment_id') : ''?>
	<?php if(IReq::get('promo')){?>
	url = "<?php echo IUrl::creatUrl("/simple/cart2/id/@id@/num/@num@/type/@type@/promo/@promo@/active_id/@active_id@");?>";
	url = url.replace("@id@",id).replace("@num@",num).replace("@type@",type).replace("@promo@",'<?php echo IReq::get("promo");?>').replace("@active_id@","<?php echo IReq::get('regiment_id');?>");
	<?php }else{?>
	url = "<?php echo IUrl::creatUrl("/simple/cart2/id/@id@/num/@num@/type/@type@/");?>";
	url = url.replace("@id@",id).replace("@num@",num).replace("@type@",type);
	<?php }?>
	window.location.href=url;
}
</script>
	<div class="position"><span>您当前的位置：</span><a href="<?php echo IUrl::creatUrl("");?>"> 首页</a> » <?php if(isset($category['id'])){?><a href="<?php echo IUrl::creatUrl("/site/pro_list/cat/$category[id]");?>"><?php echo isset($category['name'])?$category['name']:"";?></a> » <?php }?><?php echo isset($name)?$name:"";?></div>
	<div class="wrapper clearfix">
	<div id="info"></div>
		<div class="summary">
					<h2><?php echo isset($name)?$name:"";?></h2>
					<ul>
						<li><span class="f_r light_gray" id="goods_no">商品编号：<?php echo $goods_no?$goods_no:$id;?></span><?php if(isset($brand)){?>品&nbsp;&nbsp;&nbsp;&nbsp;牌：<?php echo isset($brand)?$brand:"";?><?php }?></li>
						<?php $real_price = 0;?>
						<?php if($active!=''){?>
							<?php if($active=='time'){?>
								<?php if(isset($promotion)){?>
									<?php $real_price = $promotion['award_value'];?>
									<li class="current">
										<span class="bold red2">抢 购 价：</span><b class="price red2"><span class="f30">￥</span><?php echo isset($promotion['award_value'])?$promotion['award_value']:"";?></b>
										<?php $query = new IQuery("promotion");$query->fields = "award_value,end_time,user_group";$query->where = "type = 1 and `condition` = $id and  NOW() between start_time and end_time";$items = $query->find(); foreach($items as $key => $item){?>
										<?php $free_time = ITime::getDiffSec($item['end_time'])?>
										<span class="time" id="promotiona">还剩 <i class="bold red2" id='cd_hour_promotiona'><?php echo floor($free_time/3600);?></i>小时<i class="bold red2" id='cd_minute_promotiona'><?php echo floor(($free_time%3600)/60);?></i>分<i class="bold red2" id='cd_second_promotiona'><?php echo $free_time%60;?></i>秒结束</span>
										<script type='text/javascript'>
											cd_timer.add('promotiona');
										</script>
										<?php }?>
									</li>
									<li>销&nbsp;售&nbsp;价：<s class="price light_gray"><span class="f30" id="sell_price">￥<?php echo isset($sell_price)?$sell_price:"";?></span></s>&nbsp;<?php if($sell_price!=0){?>(<?php echo number_format($promotion['award_value']/$sell_price*10,2);?>)折<?php }?>&nbsp;立省：￥<?php echo abs($sell_price-$promotion['award_value']);?></li>
								<?php }else{?>
									<li>销&nbsp;售&nbsp;价：<b class="price red2"><span class="f30" id="sell_price"><?php if($ma!=''){?><?php if($ma!=$mi){?>￥<?php echo isset($mi)?$mi:"";?>-￥<?php echo isset($ma)?$ma:"";?><?php }else{?>￥<?php echo isset($ma)?$ma:"";?><?php }?><?php }else{?>￥<?php echo isset($sell_price)?$sell_price:"";?><?php }?></span></b></li>
									<li><span class="f30" id="sell_price"><img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/images/front/grab_expir.png";?>" style="float:right;"/></span></li>
								<?php }?>
							<?php }else{?>
								<?php if(isset($regiment)){?>
									<?php $real_price = $regiment['regiment_price'];?>
									<li class="current">
										<span class="bold red2">团 购 价：</span><b class="price red2"><span class="f30">￥</span><?php echo isset($regiment['regiment_price'])?$regiment['regiment_price']:"";?></b>
										<?php $query = new IQuery("regiment");$query->fields = "id as rid,regiment_price,end_time,start_time";$query->where = "goods_id = $id and  NOW() between start_time and end_time";$items = $query->find(); foreach($items as $key => $item){?>
											<?php $free_time = ITime::getDiffSec($item['end_time'])?>
											<span class="time" id="promotiona">还剩 <i class="bold red2" id='cd_hour_promotionb'><?php echo floor($free_time/3600);?></i>小时<i class="bold red2" id='cd_minute_promotionb'><?php echo floor(($free_time%3600)/60);?></i>分<i class="bold red2" id='cd_second_promotionb'><?php echo $free_time%60;?></i>秒结束</span>
											<script type='text/javascript'>
												cd_timer.add('promotionb');
											</script>
											<?php $query = new IQuery("regiment_user_relation");$query->fields = "count(id) as tot";$query->where = "regiment_id = $item[rid]";$items = $query->find(); foreach($items as $key => $va){?>
												<span class="bold red2">已参加团购<?php echo isset($va['tot'])?$va['tot']:"";?>人</span>
											<?php }?>
										<?php }?>
									</li>
									<li>销&nbsp;售&nbsp;价：<s class="price light_gray"><span class="f30" id="sell_price">￥<?php echo isset($sell_price)?$sell_price:"";?></span></s>&nbsp;<?php if($sell_price!=0){?>(<?php echo number_format($regiment['regiment_price']/$sell_price*10,2);?>)折<?php }?>&nbsp;立省：￥<?php echo abs($sell_price-$regiment['regiment_price']);?></li>
								<?php }else{?>
									<li>销&nbsp;售&nbsp;价：<b class="price red2"><span class="f30" id="sell_price"><?php if($ma!=''){?><?php if($ma!=$mi){?>￥<?php echo isset($mi)?$mi:"";?>-￥<?php echo isset($ma)?$ma:"";?><?php }else{?>￥<?php echo isset($ma)?$ma:"";?><?php }?><?php }else{?>￥<?php echo isset($sell_price)?$sell_price:"";?><?php }?></span></b></li>
									<li><span class="f30" id="sell_price"><img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/images/front/group_expir.png";?>" style="float:right;"/></span></li>
								<?php }?>
							<?php }?>
						<?php }else{?>
						<?php $real_price = $sell_price;?>
						<li>销&nbsp;售&nbsp;价：<b class="price red2"><span class="f30" id="sell_price"><?php if($ma!=''){?><?php if($ma!=$mi){?>￥<?php echo isset($mi)?$mi:"";?>-￥<?php echo isset($ma)?$ma:"";?><?php }else{?>￥<?php echo isset($ma)?$ma:"";?><?php }?><?php }else{?>￥<?php echo isset($sell_price)?$sell_price:"";?><?php }?></span></b></li>
						<?php }?>
						<li><span class="light_gray">市&nbsp;场&nbsp;价：<s id="market_price"><?php if($mpa!=''){?><?php if($mpa!=$mpi){?>￥<?php echo isset($mpi)?$mpi:"";?>-￥<?php echo isset($mpa)?$mpa:"";?><?php }else{?>￥<?php echo isset($mpa)?$mpa:"";?><?php }?><?php }else{?>￥<?php echo isset($market_price)?$market_price:"";?><?php }?></s></span><span id="user_price"><?php if(!empty($u_id) && !empty($group_price)){?>&nbsp;&nbsp;&nbsp;&nbsp;会&nbsp;员&nbsp;价:<?php echo isset($group_price)?$group_price:"";?><?php }?></span></li>
						<li>
							库&nbsp;&nbsp;&nbsp;&nbsp;存：现货
								<span id="store_nums">(<?php echo isset($store_nums)?$store_nums:"";?>)</span><!-- 抢购或者正常销售  -->
								<input type="hidden" name="goods_nums" id="goods_nums" value="<?php echo isset($store_nums)?$store_nums:"";?>"/>
							<?php if($this->user['user_id'] == null){?>
							<?php $tmpId=IReq::get('id');?>
							<a class="favorite" href="<?php echo IUrl::creatUrl("/simple/login/?callback=/site/products/id/$tmpId");?>">收藏此商品</a>
							<?php }else{?>
							<a class="favorite" href="javascript:void(0)" onclick="favorite_add(this);">收藏此商品</a>
							<?php }?>
						</li>
						<li>顾客评分：<span class="grade"><i style="width:<?php echo $comment_num?(14*$comment_point/$comment_num):0;?>px;"></i></span> (已有<?php echo isset($comment_num)?$comment_num:"";?>人评价)&nbsp;&nbsp;&nbsp;&nbsp;<?php if($point>0){?><span>送&nbsp;积&nbsp;分：单件送<?php echo isset($point)?$point:"";?>分</span><?php }?></li>
						<li class="relative" style="z-index:2">至<a class="sel_area blue" href="javascript:;" id="show_area"><span id="city"></span></a>：<span id="delive"></span>
							<div class="area_box" style="display:none;" id="area_box">
								<ul>
									<li><a data-code="1" href="#J_PostageTableCont"><strong>全部</strong></a></li>
									<?php foreach($city as $key => $item){?>
									<li><a href="javascript:;" onclick="delivery('<?php echo isset($item['area_id'])?$item['area_id']:"";?>','<?php echo isset($item['area_name'])?$item['area_name']:"";?>')"><?php echo isset($item['area_name'])?$item['area_name']:"";?></a></li>
									<?php }?>
								</ul>
							</div>
						</li>
					</ul>

					<div class="current">
						<div id="hidd_id">
							<input type="hidden" name="goods_id" id="goods_id" value="<?php echo isset($id)?$id:"";?>"/>
							<input type="hidden" name="real_price" id="real_price" value="<?php echo isset($real_price)?$real_price:"";?>"/>
						</div>
						<?php if($store_nums>0){?>
							<?php $arr = unserialize($spec_array);?>
							<?php if(count($arr)>0){?>
							<input type="hidden" name="products_id" id="products_id" value="0"/>
								<?php foreach($arr as $k => $item){?>
									<dl class="m_10 clearfix">
										<dt><?php echo isset($item['name'])?$item['name']:"";?>：</dt>
										<dd class="w_45" style="margin-left:67px;">
											<?php $asd = substr($item['value'],0,-1); $brr = explode(',',$asd);?>
											<?php foreach($brr as $key => $va){?>
												<?php $spec_value = md5($va);$type = $item['type'];?>
												<?php if($item['type']==1){?>
												<div class="item w_27"><a href="javascript:;" id="<?php echo isset($spec_value)?$spec_value:"";?>" onclick="sele_spec(this,<?php echo isset($item['id'])?$item['id']:"";?>,'<?php echo isset($spec_value)?$spec_value:"";?>','<?php echo isset($va)?$va:"";?>','<?php echo isset($type)?$type:"";?>')"><?php echo isset($va)?$va:"";?><span></span></a></div>
												<?php }else{?>
												<div class="item"><a href="javascript:;" id="<?php echo isset($spec_value)?$spec_value:"";?>" onclick="sele_spec(this,<?php echo isset($item['id'])?$item['id']:"";?>,'<?php echo isset($spec_value)?$spec_value:"";?>','<?php echo isset($va)?$va:"";?>','<?php echo isset($type)?$type:"";?>')"><img src="<?php echo IUrl::creatUrl("")."$va";?>" width='30px' height='30px'><span></span></a></div>
												<?php }?>
											<?php }?>
										</dd>
									</dl>
								<?php }?>
							<?php }?>
	<!--					<dl class="m_10 clearfix"><dt class="hidden">提示信息：</dt><dd class="light_gray"> (除以上尺码有货，其他尺码均已售完，无法购买)</dd></dl>-->
							<dl class="m_10 clearfix"><dt>购买数量：</dt><dd><input class="gray_t f_l" type="text" name="number" id="number" onblur="return input();" value="1" maxlength="5"/><div class="resize"><a class="add" href="javascript:;" onclick="return modified(1);"></a><a class="reduce" href="javascript:;" onclick="return modified(-1);"></a></div></dd></dl>
							<?php if(isset($spec_ids) && count($spec_ids)>0){?>
								<p class="m_10">已选择：<span class="orange bold" id="chosen"></span></p>
							<?php }?>
							<input class="submit_buy" type="button" id="buy_now" onclick="buy_now();" value="立即购买" />

							<?php if($active==''){?>
								<div class="shop_cart" style="z-index:1">
									<input type="button" class="submit_join" id="join_car" onclick="joinCart();" value="加入购物车">

									<div class="shopping" id="product_myCart" style='display:none'>
										<dl class="cart_stats">
											<dt class="gray f14 bold"><a class="close_2 f_r" href="javascript:closeCartDiv();" title="关闭">关闭</a><img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/images/front/right_s.gif";?>" width="24" height="24" alt="" />成功加入购物车</dt>
											<dd class="gray">目前选购商品共<b class="orange" name='mycart_count'></b>件<span>合计：<b name='mycart_sum'></b></span></dd>
											<dd><a class="btn_blue bold" href="<?php echo IUrl::creatUrl("/simple/cart");?>">进入购物车</a><a class="btn_blue bold" href="javascript:void(0)" onclick="closeCartDiv();">继续购物>></a></dd>
										</dl>
									</div>
								</div>
							<?php }?>
						<?php }else{?>
							该商品已售完，不能购买，您可以看看其它商品！(<a href="<?php echo IUrl::creatUrl("/simple/arrival/goods_id/$id");?>">到货通知</a>)
						<?php }?>
					</div>
				</div>
		<div class="preview">
			<div class="pic_show" id="pic_show" style="width:435px;position:relative; z-index:5">
			<?php $left_img=$right_img=IUrl::creatUrl().'views/default/skin/default/images/front/nopic_435_435.gif'?>
			<?php if(isset($photo) && count($photo)>0){?>
				<?php $first_photo=current($photo);reset($photo);?>
				<?php $left_img=Thumb::get($first_photo['img'],435,435);?>
				<?php $right_img=IUrl::creatUrl().$first_photo['img'];?>
        		<script type="text/javascript" src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/";?>jquery.bxSlider/jquery.bxSlider.min.js"></script>
				<script type="text/javascript">
					$(document).ready(function(){
						//初始化bx
						var bxObj = $('#pic_thumb').bxSlider({
							controls:true,
							displaySlideQty:5,
							infiniteLoop:false,
							onAfterSlide:function(currentSlideNumber, totalSlideQty, currentSlideHtmlObjec)
							{
								$(currentSlideHtmlObjec).find("a").click();
							}
						});

						//在最后一幅图点击下一个时自动回到第一个
						$(".bx-next").click(function(){
							if(bxObj.getCurrentSlide() == bxObj.getSlideCount()-1)
							{
								bxObj.goToFirstSlide();
								return false;
							}
						});

						//重新实现点击上一个时的处理逻辑
						$(".bx-prev").unbind('click');
						$(".bx-prev").click(function(){
							if(bxObj.getCurrentSlide() == 0)
							{
								bxObj.goToLastSlide();
							}
							else
							{
								bxObj.goToPreviousSlide();
							}
							return false;
						});

						$('.jqzoom').jqzoom({
							title:false,
							xOffset:10,
							preloadImages:true
						});
					});
				</script>
			<?php }?>
        		<a class="jqzoom" href="<?php echo isset($right_img)?$right_img:"";?>" rel='gal1'>
					<img src="<?php echo isset($left_img)?$left_img:"";?>"  style="border:none;" />
				</a>
			</div>
			<div class="m_10 bx_wrap" style="margin-left:45px;">
				<div class="bx_container">
					<ul id="pic_thumb" class="pic_thumb m_10">
						<?php foreach($photo as $key => $item){?>
							<?php 	$img=IUrl::creatUrl().$item['img'];
									$left_img=Thumb::get($item['img'],435,435);
									$right_image=$img;
							?>
						<li style="margin:0px;padding-right:4px;"><a class="zoomThumbActive" href='javascript:void(0);' rel="{gallery: 'gal1', smallimage: '<?php echo isset($left_img)?$left_img:"";?>',largeimage: '<?php echo isset($right_image)?$right_image:"";?>'}"><img src='<?php echo isset($left_img)?$left_img:"";?>' width="60" height="60" /></a></li>
						<?php }?>
					</ul>
				</div>
			</div>
		</div>
	</div>
<script type="text/javascript">
//如果抢购或团购过期则不许立即购买
<?php if($active!='' && !isset($promotion) && !isset($regiment)){?>
	$('#buy_now').attr('disabled','disabled');
	$('#buy_now').addClass('disabled');
<?php }?>

<?php if($active!=''){?>
	<?php $reg_id = IReq::get('regiment_id');?>
	<?php if(Regiment::isFull($reg_id)){?>
		$('#buy_now').attr('disabled','disabled');
		$('#buy_now').addClass('disabled');
	<?php }?>
	<?php if(ISafe::get('user_id')){?>
		<?php if(Regiment::hasJoined($reg_id,ISafe::get('user_id'))){?>
		$('#buy_now').attr('disabled','disabled');
		$('#buy_now').addClass('disabled');
		<?php }?>
	<?php }else{?>
		<?php if(ICookie::get("regiment_".$reg_id)){?>
			<?php if(Regiment::hasJoined($reg_id,ICookie::get("regiment_".$reg_id))){?>
			$('#buy_now').attr('disabled','disabled');
			$('#buy_now').addClass('disabled');
			<?php }?>
		<?php }?>
	<?php }?>
<?php }?>

/******循环生成********/
var ids = '<?php echo isset($ids)?$ids:"";?>';
if(ids!='')
{
	ids = ids.substring(0,ids.length-1);
	var id_arr = ids.split(',');
	for(var i=0;i<id_arr.length;i++){
		var html = "<input type='hidden' id='spec"+id_arr[i]+"' name='spec"+id_arr[i]+"' value='' />";
		$('#hidd_id').append(html);
		var name = "<span id='name"+id_arr[i]+"'></span>";
		$('#chosen').append(name);
	}
	$('#products_id').val('');
}
//规格的选择
function sele_spec(obj,id,va,real,type)
{
	var aa = $('#spec'+id).val();
	if(aa==va)
	{
		$('#'+aa).removeClass("current");
		$('#spec'+id).val('');
		$('#products_id').val('');
		$('#name'+id).html('');
	}
	else
	{
		if(aa!=''){$('#'+aa).removeClass("current");}
		$('#spec'+id).val(va);
		$('#'+va).addClass("current");
		$('#chosen').show();
		if(type==2)
		{
			real = '<img class="img_border" src="<?php echo IUrl::creatUrl("")."'+real+'";?>" width="30px" height="30px"/>';
			$('#name'+id).html(' '+real+' ');
		}else{
			$('#name'+id).html(' "'+real+'" ');
		}
	}
	//当团购或抢购过期
	<?php if($active!='' && !isset($promotion) && !isset($regiment)){?>
		return false;
	<?php }?>
	<?php if($active!=''){?>
		<?php $reg_id = IReq::get('regiment_id');?>
		<?php if(Regiment::isFull($reg_id)){?>
			return false;
		<?php }?>
		<?php if(ISafe::get('user_id')){?>
			<?php if(Regiment::hasJoined($reg_id,ISafe::get('user_id'))){?>
				return false;
			<?php }?>
		<?php }else{?>
			<?php if(ICookie::get("regiment_".$reg_id)){?>
				<?php if(Regiment::hasJoined($reg_id,ICookie::get("regiment_".$reg_id))){?>
					return false;
				<?php }?>
			<?php }?>
		<?php }?>
	<?php }?>
	//判断是不是所有的规格都已经选取,选取则
	var flag = 0;
	var cc = '';
	for(var i=0;i<id_arr.length;i++){
		var spec = $('#spec'+id_arr[i]).val();
		cc += spec+',';
		if(spec=='')
		{
			flag = 1;
		}
	}
	if(flag==0)
	{
		var goods_id = $('#goods_id').val();
		var url = '<?php echo IUrl::creatUrl("/site/spec_md5/cid/@cid@/gid/@gid@/@Math@");?>';
		url = url.replace("@cid@",cc).replace("@gid@",goods_id).replace("@Math@",Math.random);
		$.get(url, function(data){
			if(data!=0){
				$('#buy_now').removeAttr('disabled');
				$('#join_car').removeAttr('disabled');
				$('#buy_now').removeClass('disabled');
				$('#join_car').removeClass('disabled');
				var arr = data.split(',');
				$('#products_id').val(arr[0]);
				<?php if($active!='groupon'){?>
				$('#real_price').val(arr[1]);
				$('#sell_price').html('￥'+arr[1]);
				$('#market_price').html('￥'+arr[2]);
				$('#store_nums').html('('+arr[3]+')');
				<?php }?>
				$('#goods_nums').val(arr[3]);
				$('#goods_no').html('商品编号：'+arr[4]);
				if(arr[3]==0)
				{
					$('#buy_now').attr('disabled','disabled');
					$('#join_car').attr('disabled','disabled');
					$('#buy_now').addClass('disabled');
					$('#join_car').addClass('disabled');
				}
				//会员价格
				if(arr[5]!=0)
				{
					$('#user_price').html('&nbsp;&nbsp;&nbsp;&nbsp;会&nbsp;员&nbsp价:'+arr[5]);
				}
				else
				{
					$('#user_price').html('');
				}
			}
			else
			{
				$('#buy_now').attr('disabled','disabled');
				$('#join_car').attr('disabled','disabled');
				$('#buy_now').addClass('disabled');
				$('#join_car').addClass('disabled');
				$('#product_myCart').hide();
			}
		});
	}
}
//购物车数量的加减
function modified(code){
	var number = $('#number').val();
	 if(!(number.match(/\D/)===null)){
		alert('购买数量请输入数字!');
		$("#number")[0].focus();
		return false;
	}
	if(code==1){
		var cc = $('#goods_nums').val();
		if(parseInt(number)>=parseInt(cc))
		{
			$('#number').val(cc);
		}
		else
		{
			$('#number').val(parseInt(number)+1);
		}
	}
	if(code==-1){
		if(parseInt(number)<2)
		{
			$('#number').val('1');
		}
		else
		{
			$('#number').val(parseInt(number)-1);
		}
	}
}
//购物车手动输入数量
function input()
{
	var number = $('#number').val();
	if(!(number.match(/\D/)===null)){
		alert('购买数量请输入数字!');
		$("#number")[0].focus();
		//如输入的为非数字，则强制为1
		$('#number').val('1');
		return false;
	}
	var cc = $('#goods_nums').val();
	if(parseInt(number)>parseInt(cc))
	{
		alert('您的购买量不能大于库存!');
		$("#number")[0].focus();
		$('#number').val(cc);
	}
	if(number<=0)
	{
		alert('请输入大于零的数字!');
		$("#number")[0].focus();
		//如输入的小于零，则强制为1
		$('#number').val('1');
		return false;
	}
}

//商品加入购物车
function joinCart()
{
	var goods_num  = parseInt($('#number').val());
	var goods_id   = parseInt($('#goods_id').val());
	var price      = parseFloat($('#real_price').val());
	var msg        = '';

	//goods模式
	if($('#products_id').val() == undefined)
	{
		var type = 'goods';
	}

	//product模式
	else
	{
		var product_id = parseInt($('#products_id').val());
		if(isNaN(product_id))
		{
			msg = '请选择商品的规格';
		}
		var goods_id = product_id;
		var type     = 'product';
	}

	if(isNaN(goods_num))
	{
		msg = '商品ID参数必须为数字';
	}

	else if(isNaN(price))
	{
		msg = '商品价格必须为数字';
	}

	if(msg != '')
	{
		alert(msg);
	}
	else
	{
		var thisSum = goods_num * price;
		var url = '<?php echo IUrl::creatUrl("/simple/joinCart/goods_id/@goods_id@/type/@type@/goods_num/@goods_num@/@Math@");?>';
		url = url.replace("@goods_id@",goods_id).replace("@type@",type).replace("@goods_num@",goods_num).replace("@Math@",Math.random);
		$.getJSON(url,function(content){
			if(content.isError == false)
			{
				var mycartCount  = parseInt(content.data['count']);
				var currentCount = parseInt($('[name="mycart_count"]').html());
				if(mycartCount > currentCount)
				{
					$('[name="mycart_sum"]').html('￥' + parseFloat(content.data['sum']));
					$('[name="mycart_count"]').html(mycartCount);
				}
				else
				{
					$('[name="mycart_sum"]').html('￥' + parseFloat(content.data['sum'] + thisSum));
					$('[name="mycart_count"]').html(mycartCount + goods_num);
				}
				$('#product_myCart').show();
				$('#join_car').attr('disabled','disabled');
			}
			else
			{
				alert(content.message);
			}
		});
	}
}

//添加收藏夹
function favorite_add(obj)
{
	var goods_id   = parseInt($('#goods_id').val());
	var url = '<?php echo IUrl::creatUrl("/simple/favorite_add/goods_id/@goods_id@/@Math@");?>';
		url = url.replace("@goods_id@",goods_id).replace("@Math@",Math.random);

	$.getJSON(url,function(content){
		if(content.isError == false)
		{
			obj.innerHTML = content.message;
		}
		else
		{
			alert(content.message);
		}
	});
}
</script>
	<div class="wrapper clearfix container_2">
		<div class="sidebar f_l">
			<div class="box m_10">
				<div class="title">购买本商品的用户还购买过</div>
				<div class="content">
				  <ul class="ranklist">
				  	<?php $query = new IQuery("order_goods as og");$query->join = "join order as o on og.order_id = o.id left join goods as lg on lg.id = og.goods_id AND lg.is_del = 0";$query->fields = "DISTINCT lg.name,format(lg.sell_price,2) as price,lg.small_img,lg.id";$query->where = "o.user_id in ($shop_goods) AND lg.id is not null";$query->order = "o.completion_time desc";$query->limit = "5";$items = $query->find(); foreach($items as $key => $item){?>
				  		<li class="current"><a href="<?php echo IUrl::creatUrl("/site/products/id/$item[id]");?>"><img width="58" height="58" src="<?php echo IUrl::creatUrl().$item['small_img'];?>"></a><a title="<?php echo isset($item['name'])?$item['name']:"";?>" class="p_name" href="<?php echo IUrl::creatUrl("/site/products/id/$item[id]");?>"><?php echo isset($item['name'])?$item['name']:"";?></a><b>￥<?php echo isset($item['price'])?$item['price']:"";?></b></li>
				  	<?php }?>
				  </ul>
				</div>
			</div>
			<div class="box m_10">
				<div class="title">热卖商品</div>
				<div class="content">
				  <ul class="ranklist">
				  <?php $query = new IQuery("commend_goods as cg");$query->join = "left join goods as lg on lg.id = cg.goods_id";$query->fields = "lg.name,lg.sell_price,lg.small_img,lg.id";$query->where = "commend_id = 3 AND lg.is_del = 0 AND lg.id is not null";$query->order = "lg.sort asc,lg.id desc";$query->limit = "5";$items = $query->find(); foreach($items as $key => $item){?>
					<li class="current"><a href="<?php echo IUrl::creatUrl("/site/products/id/$item[id]");?>"><img width="58" height="58" alt="<?php echo isset($item['name'])?$item['name']:"";?>" <?php if(trim($item['small_img'])!=""){?> src="<?php echo IUrl::creatUrl().$item['small_img'];?>"<?php }?>>  </a><a title="<?php echo isset($item['name'])?$item['name']:"";?>" class="p_name" href="<?php echo IUrl::creatUrl("/site/products/id/$item[id]");?>"><?php echo isset($item['name'])?$item['name']:"";?></a><b>￥<?php echo isset($item['sell_price'])?$item['sell_price']:"";?></b></li>
				  <?php }?>
				  </ul>
				</div>
			</div>
			<div class="box m_10">
				<div class="title">浏览记录</div>
				<div class="cont">
				  <ul class="ranklist">
				  <?php $cook_id ='0'?>
				  <?php if(isset($_COOKIE['recentlyviewedproducts'])){?>
					<?php $cook_id = IFilter::act( substr($_COOKIE['recentlyviewedproducts'],0,-1) ); ?>
				  <?php }?>
				  <?php $query = new IQuery("goods as lg");$query->fields = "lg.name,lg.sell_price,lg.small_img,lg.id";$query->where = "lg.id in ($cook_id)";$query->limit = "10";$items = $query->find(); foreach($items as $key => $item){?>
				  	<li class="current"><a href="<?php echo IUrl::creatUrl("/site/products/id/$item[id]");?>"><img width="58" height="58" alt="<?php echo isset($item['name'])?$item['name']:"";?>" <?php if(trim($item['small_img'])!=""){?> src="<?php echo IUrl::creatUrl().$item['small_img'];?>"<?php }?>></a><a title="<?php echo isset($item['name'])?$item['name']:"";?>" class="p_name" href="<?php echo IUrl::creatUrl("/site/products/id/$item[id]");?>"><?php echo isset($item['name'])?$item['name']:"";?></a><b>￥<?php echo isset($item['sell_price'])?$item['sell_price']:"";?></b></li>
				  <?php }?>
					<li class="more"><a href="javascript:void(0);" onclick="clearCook();">清除列表</a></li>
				  </ul>
				</div>
			</div>
		</div>
		<div class="main f_r" style="overflow:hidden">
			<!-- 商品详情 start -->
			<div class="uc_title">
				<label class="current" onclick="selectTab('tab_1','lab-1')" id="lab-1" name="lab-name"><span>商品详情</span></label><label onclick="selectTab('tab_2','lab-2')" id="lab-2" name="lab-name"><span>顾客评价(<?php echo isset($comment_num)?$comment_num:"";?>)</span></label><label onclick="selectTab('tab_3','lab-3')" id="lab-3" name="lab-name"><span>购买记录(<?php echo isset($shop_num)?$shop_num:"";?>)</span></label><label onclick="selectTab('tab_4','lab-4')" id="lab-4" name="lab-name"><span>购买前咨询(<?php echo isset($refer)?$refer:"";?>)</span></label><label onclick="selectTab('tab_5','lab-5')" id="lab-5" name="lab-name"><span>网友讨论圈(<?php echo isset($discussion)?$discussion:"";?>)</span></label><!-- <label onclick="selectTab('tab_6','lab-6')" id="lab-6" name="lab-name"><span>售后服务</span></label><label onclick="selectTab('tab_7','lab-7')" id="lab-7" name="lab-name"><span>支付方式</span></label> -->
			</div>
			<div id="tab_1" name="div_name">
				<ul class="saleinfos m_10 clearfix">
					<li>商品名称：<?php echo isset($name)?$name:"";?></li>
					<?php if(isset($brand) && $brand!=''){?><li>品　　牌：<?php echo isset($brand)?$brand:"";?></li><?php }?>
					<?php if(isset($weight) && $weight!=''){?><li>商品毛重：<?php echo isset($weight)?$weight:"";?></li><?php }?>
					<?php if(isset($unit) && $unit!=''){?><li>单　　位：<?php echo isset($unit)?$unit:"";?></li><?php }?>
					<?php if(isset($up_time) && $up_time!=''){?><li>上架时间：<?php echo isset($up_time)?$up_time:"";?></li><?php }?>
					<?php if(count($attribute)>0){?>
					<?php foreach($attribute as $key => $item){?>
						<li><?php echo isset($item['name'])?$item['name']:"";?>：<?php echo isset($item['attribute_value'])?$item['attribute_value']:"";?></li>
					<?php }?>
					<?php }?>
				</ul>
				<?php if(strlen($content1)>0){?>
				<div class="salebox">
					<strong class="saletitle block">产品描述：</strong>
					<p class="saledesc"><?php echo isset($content1)?$content1:"";?></p>
				</div>
				<?php }?>
			</div>
			<!-- 商品详情 end -->
			<!-- 顾客评论 start -->
			<div class="comment_list box" id="tab_2" name="div_name" style="display:none;">
				<div class="title3">
				<?php if(!empty($u_id)){?>
				<?php $query = new IQuery("comment");$query->fields = "id";$query->where = "goods_id = $id and user_id = $u_id";$query->limit = "1";$items = $query->find(); foreach($items as $key => $item){?>
					<span class="f_r f12 light_gray normal">只有购买过该商品的用户才能进行评价<a class="comm_btn" href="<?php echo IUrl::creatUrl("/site/comments/id/$item[id]");?>">我要评论</a></span>
				<?php }?>
				<?php }?>
				<img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/images/front/comm.gif";?>" width="16" height="16" alt="" />商品评论<span class="f12 normal">（已有<b class="red2"><?php echo isset($comment_num)?$comment_num:"";?></b>条）</span></div>
				<div id="comment">
					<?php $quer_com = new IQuery("comment as c");$quer_com->join = "left join goods as lg on c.goods_id = lg.id AND lg.is_del = 0 left join user as u on u.id = c.user_id";$quer_com->fields = "c.time,u.head_ico,c.comment_time,c.contents,c.point,lg.id as gid,c.user_id";$quer_com->where = "c.goods_id = $id and c.status = 1";$quer_com->order = "c.comment_time desc";$quer_com->page = "1";$items = $quer_com->find(); foreach($items as $key => $item){?>
					<div class="item">
						<div class="user">
							<div class="ico"><a href="<?php echo IUrl::creatUrl("/site/products/id/$item[gid]");?>">
							<img src="<?php echo IUrl::creatUrl("")."$item[head_ico]";?>" width="70" height="70" onerror="this.src='<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/images/front/user_ico.gif";?>'" />
							</a></div>
							<?php $query = new IQuery("user as u");$query->join = "left join member as m on m.user_id = u.id";$query->fields = "u.username,m.group_id";$query->where = "u.id = $item[user_id]";$items = $query->find(); foreach($items as $key => $va){?>
								<?php if($va['username']){?><span class="blue"><?php echo isset($va['username'])?$va['username']:"";?></span><?php }?>
								<?php $query = new IQuery("user_group");$query->fields = "group_name";$query->where = "id = $va[group_id]";$items = $query->find(); foreach($items as $key => $it){?>
									<?php if($it['group_name']){?><p class="gray">(<?php echo isset($it['group_name'])?$it['group_name']:"";?>)</p><?php }?>
								<?php }?>
							<?php }?>
						</div>
						<dl class="desc"><?php $wid = 14*$item['point']?>
							<p class="clearfix"><b>评分：</b><span class="grade"><i style="width:<?php echo $wid;?>px"></i></span><span class="light_gray"><?php echo isset($item['time'])?$item['time']:"";?></span><label></label></p>
							<hr />
							<p><b>评价：</b><span class="gray"><?php echo isset($item['contents'])?$item['contents']:"";?></span></p>
						</dl>
						<div class="corner b"></div>
					</div>
					<hr />
					<?php }?>
					<?php echo $quer_com->getPageBar("javascript:void(0);",'onclick="comment_ajax([page])"');?>
				</div>
			</div>
<script type="text/javascript">
function comment_ajax(page)
{
	var url = '<?php echo IUrl::creatUrl("/site/comment_ajax/page/@page@/id/$id/type/comment");?>';
	url = url.replace("@page@",page);
	$.post( url ,function(date){
		$('#comment').html(date);
	});
}
function shop_ajax(page)
{
	var url = '<?php echo IUrl::creatUrl("/site/comment_ajax/page/@page@/id/$id/type/shop");?>';
	url = url.replace("@page@",page);
	$.post(url,function(date){
		$('#shop').html(date);
	});
}
function refer_ajax(page)
{
	var url = '<?php echo IUrl::creatUrl("/site/comment_ajax/page/@page@/id/$id/type/refer");?>';
	url = url.replace("@page@",page);
	$.post(url,function(date){
		$('#refer').html(date);
	});
}
function discussion_ajax(page)
{
	var url = '<?php echo IUrl::creatUrl("/site/comment_ajax/page/@page@/id/$id/type/discussion");?>';
	url = url.replace("@page@",page);
	$.post(url,function(date){
		$('#discussion').html(date);
	});
}
//发表讨论
function isset()
{
	var u_id = '<?php echo isset($u_id)?$u_id:"";?>';
	if(u_id!='')
	{
		$('#isset_publi').show();
		$('#receive').focus();
	}else{
		alert('请登陆后再发表讨论!');
		return false;
	}
}
function published()
{
	var receive = $('#receive').val();
	var captcha = $('[name="captcha"]').val();
	if($.trim(receive)=='')
	{
		alert('请输入讨论内容!');
		return false;
	}
	if($.trim(captcha)=='')
	{
		alert('请输入验证码!');
		return false;
	}
	var url = '<?php echo IUrl::creatUrl("/site/discussion/id/@id@/captcha/@captcha@/@Math@");?>';
		url = url.replace("@id@",<?php echo isset($id)?$id:"";?>).replace("@captcha@",captcha).replace("@Math@",Math.random);

	$.getJSON(url,{receive:receive},function(content){
		if(content.isError == false)
		{
			var html = '<tr><td class="t_l discussion_td" style="border:none;">'+content.group_name+'：<span class="blue">'+content.user_name+'</span></td>';
				html += '<td style="border:none;" class="t_r gray discussion_td">'+content.time+'</td></tr><tr><td class="t_l" colspan="2" style="padding:0 7px 0 13px;">'+receive+'</td></tr>';
			$('#discussion_tr').prepend(html);
			var isset_red = $('#isset_red').html();
			$('#isset_red').html(parseInt(isset_red)+1);

			$('#receive').val('');
			$('[name="captcha"]').val('');
			$('#isset_publi').hide();

			changeCaptcha('<?php echo IUrl::creatUrl("/site/getCaptcha");?>');
		}
		else
		{
			alert(content.message);
		}
	});
}
</script>
			<!-- 顾客评论 end -->
			<!-- 购买记录 start -->
			<div class="box" id="tab_3" name="div_name" style="display:none;">
				<div class="title3"><span class="f_r f12 orange">最近一个月成交记录</span><img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/";?>images/front/cart.gif" width="16" height="16" alt="" />购买记录<span class="f12 normal">（已有<b class="red2"><?php echo isset($shop_num)?$shop_num:"";?></b>购买）</span></div>
				<div id="shop">
					<table width="100%" class="list_table m_10 mt_10">
						<col width="90" />
						<col />
						<col width="80" />
						<col width="90" />
						<col width="80" />
						<col width="150" />
						<col width="60" />
						<thead class="thead">
							<tr><th>购买人</th><th>宝贝名称</th><th>会员级别</th><th>出价</th><th>数量</th><th>购买时间</th><th>状态</th></tr>
						</thead>
					</table>
					<table width="100%" class="list_table m_10">
						<col width="90" />
						<col />
						<col width="80" />
						<col width="90" />
						<col width="80" />
						<col width="150" />
						<col width="60" />
						<tbody class="dashed">
							<?php $quer = new IQuery("order_goods as og");$quer->join = "left join order as o on og.order_id = o.id";$quer->fields = "o.user_id,og.product_id,og.goods_price,og.goods_nums,o.completion_time";$quer->where = "og.goods_id = $id and o.status = 5 and (to_days(now())-to_days(o.completion_time)) < 31";$quer->order = "o.completion_time desc";$quer->page = "1";$items = $quer->find(); foreach($items as $key => $item){?>
								<tr>
									<td>
									<?php $query = new IQuery("user");$query->fields = "username";$query->where = "id = $item[user_id]";$items = $query->find(); foreach($items as $key => $va){?>
										<?php echo isset($va['username'])?$va['username']:"";?>
									<?php }?>
									</td>
								<td class="t_l">
								<?php $query = new IQuery("goods");$query->fields = "name,id as gid";$query->where = "id = $id";$items = $query->find(); foreach($items as $key => $va){?>
								<a class="blue" href="<?php echo IUrl::creatUrl("/site/products/id/$va[gid]");?>"><?php echo isset($va['name'])?$va['name']:"";?></a>
								<?php }?>
								<p>
								<?php if($item['product_id']!=0){?>
								<?php $query = new IQuery("products");$query->fields = "spec_array";$query->where = "id = $item[product_id]";$items = $query->find(); foreach($items as $key => $va){?>
									<?php $spec_array=Block::show_spec($va['spec_array']);?>
									<?php foreach($spec_array as $specName => $specValue){?>
										<?php echo isset($specName)?$specName:"";?>：<?php echo isset($specValue)?$specValue:"";?>，
									<?php }?>
								<?php }?>
								<?php }?>
								</p>
								</td>
								<td>
								<?php $query = new IQuery("user_group as ug");$query->join = "left join member as m on m.group_id = ug.id";$query->fields = "group_name";$query->where = "m.user_id = $item[user_id]";$items = $query->find(); foreach($items as $key => $va){?>
								<?php echo isset($va['group_name'])?$va['group_name']:"";?>
								<?php }?>
								</td>
								<td><?php echo isset($item['goods_price'])?$item['goods_price']:"";?></td>
								<td class="bold orange"><?php echo isset($item['goods_nums'])?$item['goods_nums']:"";?></td>
								<td class="light_gray"><?php echo isset($item['completion_time'])?$item['completion_time']:"";?></td>
								<td class="bold blue">成交</td></tr>
							<?php }?>
						</tbody>
					</table>
					<?php echo $quer->getPageBar("javascript:void(0);",'onclick="shop_ajax([1])"');?>
				</div>
			</div>
			<!-- 购买记录 end -->
			<!-- 购买前咨询 start -->
			<div class="comment_list box" id="tab_4" name="div_name" style="display:none;">
				<div class="title3"><span class="f_r f12 normal"><a class="comm_btn" href="<?php echo IUrl::creatUrl("/site/consult/id/$id");?>">我要咨询</a></span><img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/";?>images/front/cart.gif" width="16" height="16" alt="" />购买前咨询<span class="f12 normal">（共<b class="red2"><?php echo isset($refer)?$refer:"";?></b>记录）</span></div>
				<div id="refer">
					<?php $ref = new IQuery("refer as r");$ref->join = "left join user as u on r.user_id = u.id";$ref->fields = "u.username,u.head_ico,r.user_id,r.time as rtime,r.question,r.reply_time,r.answer";$ref->where = "r.goods_id = $id";$ref->order = "r.time desc";$ref->page = "1";$items = $ref->find(); foreach($items as $key => $item){?>
					<div class="item">
						<div class="user">
							<div class="ico"><img src="<?php echo IUrl::creatUrl("")."$item[head_ico]";?>" width="70" height="70" onerror="this.src='<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/images/front/user_ico.gif";?>'" /></div>
							<span class="blue"><?php echo isset($item['username'])?$item['username']:"";?></span>
							<?php $query = new IQuery("user_group as ug");$query->join = "left join member as m on m.group_id = ug.id";$query->fields = "group_name";$query->where = "m.user_id = $item[user_id]";$items = $query->find(); foreach($items as $key => $va){?>
								<?php if($va['group_name']){?><p class="gray">(<?php echo isset($va['group_name'])?$va['group_name']:"";?>)</p><?php }?>
							<?php }?>
							<p class="gray"><?php echo isset($item['rtime'])?$item['rtime']:"";?></p>
						</div>
						<dl class="desc gray">
							<p><img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/images/front/ask.gif";?>" width="16" height="17" alt="" /><b>咨询内容：</b><span class="f_r"><?php echo isset($item['rtime'])?$item['rtime']:"";?></span></p>
							<p class="indent"><?php echo isset($item['question'])?$item['question']:"";?></p>
							<hr />
							<?php if($item['answer']){?>
							<p class="bg_gray"><img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/images/front/answer.gif";?>" width="16" height="17" alt="" /><b class="orange"><?php echo $siteConfig->name;?>回复：</b><span class="f_r"><?php echo isset($item['reply_time'])?$item['reply_time']:"";?></span></p>
							<p class="indent bg_gray"><?php echo isset($item['answer'])?$item['answer']:"";?></p>
							<?php }?>
						</dl>
						<div class="corner b"></div>
						<div class="corner tl"></div>
					</div>
					<hr />
					<?php }?>
					<?php echo $ref->getPageBar("javascript:void(0);",'onclick="refer_ajax([1])"');?>
				</div>
			</div>
			<!-- 购买前咨询 end -->

			<!-- 网友讨论圈 start -->
			<div class="box" id="tab_5" name="div_name" style="display:none;">
				<div class="title3"><span class="f_r f12 normal"><a class="comm_btn" href="javascript:;" onclick="isset();">发表话题</a></span><img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/";?>images/front/discuss.gif" width="18" height="19" alt="" />网友讨论圈<span class="f12 normal">（共<b class="red2" id="isset_red"><?php echo isset($discussion)?$discussion:"";?></b>记录）</span></div>
				<div class="wrap_box no_wrap" id="discussion">
					<table width="100%" class="list_table">
						<col>
						<col width="150">
						<tbody id="discussion_tr">
						<?php $disp = new IQuery("discussion as d");$disp->join = "left join user as u on d.user_id = u.id";$disp->fields = "u.username,d.user_id,d.time as rtime,d.contents";$disp->where = "d.goods_id = $id";$disp->order = "d.time desc";$disp->page = "1";$items = $disp->find(); foreach($items as $key => $item){?>
							<tr><td class="t_l discussion_td" style="border:none;">
							<?php $query = new IQuery("user_group as ug");$query->join = "left join member as m on m.group_id = ug.id";$query->fields = "group_name";$query->where = "m.user_id = $item[user_id]";$items = $query->find(); foreach($items as $key => $va){?>
								<?php if($va['group_name']){?><?php echo isset($va['group_name'])?$va['group_name']:"";?>:<?php }?>
							<?php }?>
							<span class="blue"><?php echo isset($item['username'])?$item['username']:"";?></span></td>
							<td style="border:none;" class="t_r gray discussion_td"><?php echo isset($item['rtime'])?$item['rtime']:"";?></td></tr>
							<tr><td class="t_l" colspan="2" style="padding:0 7px 0 13px;"><?php echo isset($item['contents'])?$item['contents']:"";?></td></tr>
						<?php }?>
						</tbody>
					</table>
					<?php echo $disp->getPageBar("javascript:void(0);",'onclick="discussion_ajax([1])"');?>
					<table class="form_table" id="isset_publi" style="display:none;">
						<colgroup>
							<col width="80px">
							<col>
						</colgroup>
						<tbody>
						<tr>
							<th>讨论内容：</th><td valign="top"><textarea id="receive"></textarea></td>
						</tr>

						<tr><th>验证码：</th><td><input type='text' class='gray_s' name='captcha' pattern='^\w{5,10}$' alt='填写下面图片所示的字符' /><label>填写下面图片所示的字符</label></td></tr>
						<tr class="low"><th></th><td><img src='<?php echo IUrl::creatUrl("/site/getCaptcha");?>' id='captchaImg' /><span class="light_gray">看不清？<a class="link" href="javascript:changeCaptcha('<?php echo IUrl::creatUrl("/site/getCaptcha");?>');">换一张</a></span></td></tr>

						<tr><td></td><td><label class="btn"><input type="submit" value="发表" onclick="return published();" /></label></td></tr>
						</tbody>
					</table>
				</div>
			</div>
			<!-- 网友讨论圈 end -->

			<!-- 售后服务 start -->
			<div class="box" id="tab_6" name="div_name" style="display:none;">
				<div class="title3"><img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/";?>images/front/tel.gif" width="20" height="19" alt="" />售后服务</div>
				<div class="cont_s gray">
					<?php $query = new IQuery("help");$query->fields = "content";$query->where = "id = 52";$items = $query->find(); foreach($items as $key => $item){?>
						<?php echo $item['content'];?>
					<?php }?>
				</div>
			</div>
			<!-- 售后服务 end -->
			<!-- 支付方式 start -->
			<div class="box" id="tab_7" name="div_name" style="display:none;">
				<div class="title3"><img src="<?php echo IUrl::creatUrl("")."views/".$this->theme."/skin/".$this->skin."/";?>images/front/card.gif" width="23" height="18" alt="" />支付方式</div>
				<div class="cont_pay">
					<?php $query = new IQuery("help");$query->fields = "content";$query->where = "id = 53";$items = $query->find(); foreach($items as $key => $item){?>
						<?php echo $item['content'];?>
					<?php }?>
				</div>
			</div>
			<!-- 支付方式 end -->
		</div>
	</div>
<script type="text/javascript">
	$(document).ready(function(){address();});
	//js 加载cookie addressip
	function address(){
		var addcook = $.cookie('addressip');
		if(addcook=='' || addcook==null)
		{
			$.getScript('http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js',function(){
				addcook = remote_ip_info['province'];
				searPrivice(addcook);//查询省份的id
				$.cookie('addressip',addcook);
			});
		}else{
			//查询省份的id
			searPrivice(addcook);
		}
	}
</script>


	<?php echo $siteConfig->site_footer_code;?>
</div>
<script type='text/javascript' src='<?php echo IUrl::creatUrl("")."views/".$this->theme."/javascript/site.js";?>'></script>
<script type='text/javascript'>
	$('input:text[name="word"]').bind({
		keyup:function(){autoComplete('<?php echo IUrl::creatUrl("/site/autoComplete");?>','<?php echo IUrl::creatUrl("/site/search_list/word/@word@");?>','<?php echo isset($site_config['auto_finish'])?$site_config['auto_finish']:"";?>');}
	});

	var mycartLateCall = new lateCall(200,function(){showCart('<?php echo IUrl::creatUrl("/simple/showCart");?>')});

	//购物车div层
	$('.mycart').hover(
		function(){
			mycartLateCall.start();
		},
		function(){
			mycartLateCall.stop();
			$('#div_mycart').hide('slow');
		}
	);

	//[ajax]加入购物车
	function joinCart_ajax(id,type)
	{
		var url ="<?php echo IUrl::creatUrl("/simple/joinCart/random/@random@/goods_id/@goods_id@/type/@type@");?>";
		url = url.replace("@random@",Math.random()).replace("@goods_id@",id).replace("@type@",type);
		$.getJSON(url,function(content){
			if(content.isError == false)
			{
				var count = parseInt($('[name="mycart_count"]').html());
				$('[name="mycart_count"]').html(count + 1);
				$('.msgbox').hide();
				alert(content.message);
			}
			else
			{
				alert(content.message);
			}
		});
	}

	//列表页加入购物车统一接口
	function joinCart_list(id)
	{
		var url = "<?php echo IUrl::creatUrl("/simple/getProducts/id/@id@");?>";
		$.get('<?php echo IUrl::creatUrl("/simple/getProducts");?>',{id:id},function(content){
			if(content == '')
			{
				joinCart_ajax(id,'goods');
			}
			else
			{
				$('#product_box_'+id).html(content);
				$('#product_box_'+id).parent().show();
			}
		});
	}
</script>
</body>
</html>
